<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script>
window.onload = function()
{
		var oTxt = document.getElementById('txt1');
		
	oTxt.onkeydown = function(ev)
	{
			var oEvent = ev||event;
			//alert(oEvent.keyCode);
			if((oEvent.keyCode >=48 && oEvent.keyCode <58) || (oEvent.keyCode==37 ||oEvent.keyCode==39 ||oEvent.keyCode==46 ||oEvent.keyCode==8))
			{
					
			}
			else
			{
				return false;
			}
	};
};
</script>
</head>

<body>
<input type="text" id="txt1">
</body>
</html>
